<?php

namespace App\Observers;

use App\Models\Order;

class OrderObserver
{
	public function creating(Order $order)
	{
		if (! $order->number) {
			$order->number = serial_number(6, $order, 'number');
			
			if (! $order->number) {
				return false; // Order is failed.
			}
		}
	}
}
